-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: default template import export #208
Merged
maharshivpatel
merged 17 commits into
frappe:develop
from
maharshivpatel:feat-default-template-import-export-develop
Apr 3, 2024
Merged
feat: default template import export #208
maharshivpatel
merged 17 commits into
frappe:develop
from
maharshivpatel:feat-default-template-import-export-develop
Apr 3, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Added Custom Field for Print Designer Template Location - Added Hook to define folder location for Print Designer Templates ( location fallbacks to default_templates if not defined in hooks for export ) - when print designer is installed, loop over all apps and import standard templates. - when any new app is installed, check if it has print designer templates and install them. - it also checks print_designer app for new templates and installs them. - Modified export functionality for print formats that are made using print_designer. - it will export print format in custom directory if defined in hooks else in default_templates folder. - user / developer can define app where print format should be exported in print_designer_template_app field.
added new custom field "print_designer_preview_img" to store the format preview image. added html2canvas on save - make copy of main-container dom and convert to canvas using html2canvas. - create file instance and pass blob to it from canvas.toBlob() - send file to /api/method/upload_file , client side function is just modified version of FileUploader. - remove old format preview image after new one is uploaded successfully. This will be used to display the format preview in the format Grid View.
dynamic text value is fetched from db so there is no need to save it as part of format.
we have to consider and load metaFields from db so remove it from Print Format JSON.
- if standard is set to true, remove static file urls as it can't be used across site. - only try to load file if url value exists for the file. - This doesn't check if image file exists or not.
As standard field returns Yes or No, update the logic to compare string instead of boolean. update preview image url in print_designer_preview_img field
First check if table exists before trying to load childfield meta
Copy the image to the export directory so that it can be used for preview while installing the format.
when print_designer format is saved in developer mode and format is standard. preview images and " File " document is exported as per the location defined in the selected app's hook. after install once the formats are imported, copy the file to private/files folder and update the file path in the format.
After merging relative containers when this in this PR conflicts were manually resolved. There were some incorrect conflict resolutions, which are fixed in this commit. Also, removed multiple updates for print format document caused by updating file_url. instead get latest file_url from the file document else set to null.
maharshivpatel
force-pushed
the
feat-default-template-import-export-develop
branch
from
April 1, 2024 20:41
15d10e0
to
bbe07f9
Compare
while refactoring the code, by mistake it was changed to an array. This commit fixes it.
unintended cssRules were removed by mistake so until that can be fixed removing deleteRule code.
maharshivpatel
force-pushed
the
feat-default-template-import-export-develop
branch
from
April 2, 2024 04:22
e21640a
to
6e8469a
Compare
image upload sometime happen before the format is saved and sometimes after. handled both cases based on isFormatSaving flag.
maharshivpatel
added a commit
to maharshivpatel/print_designer
that referenced
this pull request
Apr 2, 2024
This 2 templates will be installed if erpnext is present in the system. depends on frappe#208
revert this after frappe/frappe#25779 is released in v15
when we create copy when user updates the formats with old schema. it was implicitly setting the name with copy + number suffix. now we set that name as default and prompt user if they want to change the name.
maharshivpatel
force-pushed
the
feat-default-template-import-export-develop
branch
from
April 3, 2024 05:44
35bb2bd
to
6afc817
Compare
ankush
reviewed
Apr 3, 2024
maharshivpatel
force-pushed
the
feat-default-template-import-export-develop
branch
from
April 3, 2024 07:22
6085370
to
f911516
Compare
🎉 This PR is included in version 1.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added Custom Field for Print Designer Template Location
Added Hook to define folder location for Print Designer Templates ( location fallbacks to default_templates if not defined in hooks for export )
when print designer is installed, loop over all apps and import standard templates.
when any new app is installed, check if it has print designer templates and install them. - it also checks print_designer app for new templates and installs them.
Modified export functionality for print formats that are made using print_designer. - it will export print format in custom directory if defined in hooks else in default_templates folder.
user / developer can define app where print format should be exported in print_designer_template_app field.
depends on : frappe/frappe#25752
TODO: Add template grid view for users so they can explore formats.